﻿@** Copyright 2013 Seven Spikes Ltd. All rights reserved. (http://www.nop-templates.com)
* http://www.nop-templates.com/t/licensinginfo
*@

@using Nop.Core;
@using Nop.Core.Infrastructure;

@model SevenSpikes.Nop.Plugins.MegaMenu.Models.MegaMenuModel
@{
    Html.AddCssFileParts("~/Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Themes/" + Model.Theme + "/Content/MegaMenu.css");

    var supportRtl = EngineContext.Current.Resolve<IWorkContext>().WorkingLanguage.Rtl;
    if (supportRtl)
    {
        Html.AddCssFileParts("~/Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Themes/" + Model.Theme + "/Content/MegaMenu.rtl.css");
    }

    Html.AddScriptParts("~/Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Scripts/jquery.lazyload.min.js");
}
<ul class="mega-menu">
    @if (Model.Settings.IncludeHomePageLink)
    {
        <li>
            <a href="@Url.RouteUrl("HomePage")">@T("HomePage")</a>
        </li>
    }
    @if (Model.Settings.EnableCategories)
    {
        @Html.Action("GetCategories", "MegaMenu", Model.Categories)
    }
    @{
        MvcHtmlString megaMenuTopicBlock = Html.Action("TopicBlock", "MegaMenu", new { systemName = "MegaMenuTopic" });
    }
    @if (Model.Settings.EnableMegaMenuTopic && !MvcHtmlString.IsNullOrEmpty(megaMenuTopicBlock))
    {
        <li>
            @megaMenuTopicBlock
        </li>
    }
    @if (Model.Settings.EnableManufacturers)
    {
         @Html.Action("GetManufacturers", "MegaMenu", Model.Manufacturers)
    }
    @if (Model.Settings.IncludeMyAccountLink)
    {
        <li>
            <a href="@Url.RouteUrl("CustomerInfo")">@T("Account.MyAccount")</a>
        </li>
    }
    @if (Model.Settings.IncludeBlogLink)
    {
        <li>
            <a href="@Url.RouteUrl("Blog")">@T("Blog")</a>
        </li>
    }
    @if (Model.Settings.IncludeForumLink)
    {
        <li>
            <a href="@Url.RouteUrl("Boards")">@T("Forum.Forums")</a>
        </li>
    }
    @{
        MvcHtmlString aboutUsTopicBlock = Html.Action("TopicBlock", "MegaMenu", new { systemName = "AboutUs" });
    }
    @if (Model.Settings.IncludeAboutUsLink && !MvcHtmlString.IsNullOrEmpty(aboutUsTopicBlock))
    {
        <li>@aboutUsTopicBlock</li>
        // Uncomment this line below(comment the line above to have a link to the AboutUs topic instead of a dropdown menu.
        //<li><a href="@Url.RouteUrl("Topic", new { SystemName = "aboutus" })">@T("AboutUs")</a></li>

    }
    <li><a href="@Url.RouteUrl("ShareBuyList")">Share</a></li>
    @if (Model.Settings.IncludeContactUsLink)
    {
        <li>
            <a href="@Url.RouteUrl("ContactUs")">@T("ContactUs")</a>
        </li>
    }
</ul>

@if (Model.Settings.EnableResponsiveMenu)
{
    @Html.Partial("MegaMenuResponsive", Model)
}

<script type="text/javascript" charset="utf-8">

    $(function () {
        $("img.lazy").lazyload({
            event: "menuShown",
            effect: "fadeIn"
        });
    });

    // We need to trigger an event, in order for the lazy loading to work. The default event is scroll, which is not useful in this cace
    $(".mega-menu").on("mouseover", function () {
        $("img.lazy").trigger("menuShown");
    });
</script>
